package com.android.functionmanagement.receiver;

import com.android.functionmanagement.globle.ConstantGloble;
import com.android.functionmanagement.util.SharedPreferencesUtils;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class UserInfoReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		// TODO: This method is called when the BroadcastReceiver is receiving
		// an Intent broadcast.

		if (null == intent)
			return;
		if ("android.intent.action.uwatch.REQUEST_USERINFO".equals(intent
				.getAction())) {
			String userName = SharedPreferencesUtils.getParam(context,
					ConstantGloble.USERNAME, "").toString();
			String userID = SharedPreferencesUtils.getParam(context,
					ConstantGloble.USERID, "").toString();
			String url = SharedPreferencesUtils.getParam(context,
					ConstantGloble.URL, "").toString();
			Intent in = new Intent(
					"android.intent.action.uwatch.RESPONSE_USERINFO");
			in.putExtra(ConstantGloble.USERNAME, userName);
			in.putExtra(ConstantGloble.USERID, userID);
			in.putExtra("ServerUrl", url);
			context.sendBroadcast(in);
		}
	}
}
